package com.example.springBoot.controller;

import com.example.springBoot.domain.Girl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author chenpeng
 * @date 2018/4/18 10:25
 */
@RestController //意思就是controller里面的方法都以json的格式输出,是spring4新启用的
@RequestMapping(value = "/hello")
public class HelloWorldController {
    /**
     * 使用配置文件中自定义的属性
   /*  *//*
    @Value("${cupSize}")
    private String cupSize;

    @Value("${age}")
    private Integer age;

    @Value("${content}")
    private String content;*/

    @Autowired
    private Girl girl;
    //@RequestMapping(value = "hi",method = RequestMethod.GET)
    @GetMapping("hi")
    public String index(@RequestParam(value = "myId",required = false,defaultValue = "13") int id){
        return girl.getCupSize()+id;
    }
}
